
# 提示路径问题，没有完全跑通
import  tensorflow as tf

from tensorflow.python.framework import graph_util


v1 = tf.Variable(tf.constant(1,shape=[1]),name='v1')

v2 = tf.Variable(tf.constant(2,shape=[1]),name= 'v2')

result = v1 +v2

init_op = tf.global_variables_initializer()

with tf.Session() as sess:
    sess.run(init_op)

    graph_def = tf.get_default_graph().as_graph_def()

    output_graph = graph_util.convert_variables_to_constants(sess,graph_def,['add'])

    with tf.gfile.GFile(".\\Saved_model\\combined_model.pb",'wb') as f:
        f.write(output_graph.SerializeToString())

